function y=multrand(mu,C,v); 
% ===================================================
% function y=multrand(mu,C,v); 
% 
% Sample from a multivariate t-Student 
% with mean = mu [1 p] 
% Variance = v*sigma/(v-2) 
%            sigma=(C')*C  i.e. C=chol(C)
%
% This is the algorithm suggested in 
% "Bayesian Data Analysis", Gelman et. al 1st edition 
% page 481.  
% The notation is different from Lubrano et al. 
% Alejandro Justiniano  December 19 2006 
% ==================================================
%ii=1;for ii=1:nrep;
n=length(mu);x=sqrt(gamrnd(v/2,2,1,n)./v);
y=(mu+(randn(1,n)*C)./x)';
%end;%ymat=ymat';%cov(ymat);%sigma*v./(v-2);